package day_6_26;

public class Main3 {
    /**
     * 48. 旋转图像
     * https://leetcode.cn/problems/rotate-image/description/
     */
    public void rotate(int[][] matrix) {
        int n = matrix.length;
        int[][] arr = new int[n][n];

        for(int i = 0;i < n;i++) {
            for(int j = 0;j < n;j++) {
                arr[j][n - 1 - i] = matrix[i][j];
            }
        }

        for(int i = 0;i < n;i++) {
            for(int j = 0;j < n;j++) {
                matrix[i][j] = arr[i][j];
            }
        }
    }
}
